/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ExibiDiretor.java
 *
 * Created on 16/11/2011, 21:33:43
 */
package gerenciadorescola.view;

import gerenciadorescola.model.pattern.facade.Fachada;
import java.awt.Image;
import java.awt.Toolkit;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author Pedro Freitas
 */
public class ExibiDiretor extends javax.swing.JFrame {

    /** Creates new form ExibiDiretor */
    public ExibiDiretor() {
        initComponents();
        try {
            Image icon = Toolkit.getDefaultToolkit().getImage("src/gerenciadorescola/imagens/uff.png");
            setIconImage(icon);
        } catch (Exception e) {
            e.getStackTrace();
        }




    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        respNomeDLabel = new javax.swing.JLabel();
        nomeDLabel = new javax.swing.JLabel();
        idadeDLabel = new javax.swing.JLabel();
        cpfDLabel = new javax.swing.JLabel();
        sexoDLabel = new javax.swing.JLabel();
        telDLabel = new javax.swing.JLabel();
        endDLabel = new javax.swing.JLabel();
        salarioLabel = new javax.swing.JLabel();
        respIdadeDLabel = new javax.swing.JLabel();
        respCpfDLabel = new javax.swing.JLabel();
        respSexoDLabel = new javax.swing.JLabel();
        respTelDLabel = new javax.swing.JLabel();
        respEndDLabel = new javax.swing.JLabel();
        respSalarioDLabel = new javax.swing.JLabel();
        voltarButton = new javax.swing.JButton();
        exibirDiretor = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Exibi - Escola TPA");

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18));
        jLabel1.setText("Diretor");

        respNomeDLabel.setText("*******************************************");

        nomeDLabel.setText("Nome :");

        idadeDLabel.setText("Idade :");

        cpfDLabel.setText("CPF :");

        sexoDLabel.setText("Sexo :");

        telDLabel.setText("Telefone :");

        endDLabel.setText("Endereço :");

        salarioLabel.setText("Salário :");

        respIdadeDLabel.setText("******");

        respCpfDLabel.setText("********************");

        respSexoDLabel.setText("*******");

        respTelDLabel.setText("****************");

        respEndDLabel.setText("****************************************");

        respSalarioDLabel.setText("***************");

        voltarButton.setText("Voltar");
        voltarButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                voltarButtonActionPerformed(evt);
            }
        });

        exibirDiretor.setText("Exibir");
        exibirDiretor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exibirDiretorActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(sexoDLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(respSexoDLabel))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(idadeDLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(respIdadeDLabel)
                        .addGap(67, 67, 67)
                        .addComponent(cpfDLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(respCpfDLabel))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(nomeDLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(respNomeDLabel))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(telDLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(respTelDLabel))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(endDLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(respEndDLabel))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(salarioLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(respSalarioDLabel)))
                .addContainerGap(92, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(260, Short.MAX_VALUE)
                .addComponent(exibirDiretor)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(voltarButton)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addGap(53, 53, 53)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(nomeDLabel)
                    .addComponent(respNomeDLabel))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(idadeDLabel)
                    .addComponent(cpfDLabel)
                    .addComponent(respIdadeDLabel)
                    .addComponent(respCpfDLabel))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(sexoDLabel)
                    .addComponent(respSexoDLabel))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(telDLabel)
                    .addComponent(respTelDLabel))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(endDLabel)
                    .addComponent(respEndDLabel))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(salarioLabel)
                    .addComponent(respSalarioDLabel))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 58, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(voltarButton)
                    .addComponent(exibirDiretor))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void voltarButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_voltarButtonActionPerformed
        this.dispose();
    }//GEN-LAST:event_voltarButtonActionPerformed

    private void exibirDiretorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exibirDiretorActionPerformed
        Map<String, String> saida = new HashMap();
        try {
            saida = Fachada.ComandoExibiDiretor(null);
            if (!(saida.containsKey("msg"))) {
                respNomeDLabel.setText(saida.get("nome"));
                respIdadeDLabel.setText(saida.get("idade"));
                respCpfDLabel.setText(saida.get("cpf"));
                respSalarioDLabel.setText(saida.get("salario"));
                respSexoDLabel.setText(saida.get("sexo"));
                respTelDLabel.setText(saida.get("tel"));
                respEndDLabel.setText(saida.get("end"));

            } else {
                JOptionPane.showMessageDialog(rootPane, saida.get("msg"));
            }
        } catch (Exception ex) {
            Logger.getLogger(ExibiDiretor.class.getName()).log(Level.SEVERE, null, ex);
        }

    }//GEN-LAST:event_exibirDiretorActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(ExibiDiretor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(ExibiDiretor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(ExibiDiretor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(ExibiDiretor.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                try {
                    new ExibiDiretor().setVisible(true);
                } catch (Exception ex) {
                    Logger.getLogger(ExibiDiretor.class.getName()).log(Level.SEVERE, null, ex);
                }

            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel cpfDLabel;
    private javax.swing.JLabel endDLabel;
    private javax.swing.JButton exibirDiretor;
    private javax.swing.JLabel idadeDLabel;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel nomeDLabel;
    private javax.swing.JLabel respCpfDLabel;
    private javax.swing.JLabel respEndDLabel;
    private javax.swing.JLabel respIdadeDLabel;
    private javax.swing.JLabel respNomeDLabel;
    private javax.swing.JLabel respSalarioDLabel;
    private javax.swing.JLabel respSexoDLabel;
    private javax.swing.JLabel respTelDLabel;
    private javax.swing.JLabel salarioLabel;
    private javax.swing.JLabel sexoDLabel;
    private javax.swing.JLabel telDLabel;
    private javax.swing.JButton voltarButton;
    // End of variables declaration//GEN-END:variables
}
